// pages/minePage/permisseInformation/permisseInformation.js
import { lgRequest } from '../../../utils/ajax'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    sysInfo: getApp().globalData.sysInfo,
    isIphoneX: getApp().globalData.isIphoneX,
    statusBarHeight: getApp().globalData.statusBarHeight,
    titleBarHeight: getApp().globalData.titleBarHeight,
    userId:'',
    searchList:[{}],
    quanxianmsg:{},
    rightImgIcon:'https://www.mingchuliangzao.com.cn:8632/profile/upload/2022/06/24/a14ca79c67896c3fba0b575e86f3fe34.png'
  },
  goBack(){
    wx.navigateBack({
      delta: 1
    })
  },
  menuList(){
    let params = {}
    lgRequest('menuList', params, {
      errAlert: false,
      doSuccess: r => {
        if (r.code == 200) {
          let searchList = [];
          r.data.forEach(item=>{
            let obj = {
              name:item.name,
              id:item.id
            }
            searchList.push(obj)
            if(item.children&&item.children.length>0){
              item.children.forEach(row=>{
                let obj = {
                  name:row.name,
                  id:row.id
                }
                searchList.push(obj)
              })
            }
          })
          this.setData({ searchList })
        } else {
          wx.showToast({
            title: r.msg,
            icon: 'none'
          })
        }
      },
      doComplete: r => {
      }
    })
  },
    // 获取权限信息
    getsevenday() {
      lgRequest('menuList', {}, {
        doSuccess: r => {
          console.log(r, '权限信息')
          this.setData({
            quanxianmsg: r.data
          })
        }
      })
    },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // this.menuList()
    this.getsevenday()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})